package jwdt.web.action;

import jwdt.xadmin.info.bean.TType;

import com.ezerg.db.Jdb;
import com.ezerg.web.Form;
import com.ezerg.web.Module;
import com.ezerg.web.Page;

public class ChannelAction extends BaseAction {
	
	public Page execute(Form f, Module m) throws Exception{
		int typeid = f.getInt("id",0);
		TType type = (TType)Jdb.get().get(TType.class, typeid);
		if(type==null) {
			f.add("ret", "您选择的栏目不存在");
			return m.findPage("tips");
		}
		f.add("type", type);
		if(type.getFid() != 0) {//存在上级栏目
			TType ftype = (TType)Jdb.get().get(TType.class, type.getFid());
			if(ftype!=null) {
				f.add("ftype", ftype);
			} else {
				f.add("ftype", type);
			}
		}
		int rows = 3;
		super.getListByTypeid(typeid, "objs", rows, f);//
		super.getListByTypeid2(typeid, 0, "objs0", rows, f);//
		super.getListByTypeid2(typeid, 1, "objs1", rows, f);//
		super.getListByTypeid2(typeid, 2, "objs2", rows, f);//
		super.getListByTypeid2(typeid, 3, "objs3", rows, f);//
		super.getListByTypeid2(typeid, 4, "objs4", rows, f);//
		//广告图片
		f.add("advimg7", Jdb.get().queryDataMap("select id,title,path,url from t_images where position=7 and zt=1 limit 1"));
		f.add("advimg8", Jdb.get().queryDataMap("select id,title,path,url from t_images where position=8 and zt=1 limit 1"));
		//
		return m.findPage("/channel");
	}
}
